Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Printing Extensions and Drivers /
Chapter 3 - Printer Drivers / The QuickDraw GX ImageWriter II Printer Driver Messages


Responding to Direct-Mode Queries

QuickDraw GX sends the GXJobFormatModeQuery message to get or set format-mode information. This message only applies to direct-mode printing, which the user can select for printing to a specific printing device such as the ImageWriter II. Direct mode allows for accelerated printing of text for printing devices such as the ImageWriter II; however, illustrations cannot be printed while text direct-mode printing is selected.

QuickDraw GX can make various requests through the GXJobFormatModeQuery message that you need to respond to, including requests

These requests apply only to text and line printing mode. The GXJobFormatModeQuery message is described on page 4-59 in the chapter "Printing Messages." For a complete list and description of the GXJobFormatModeQuery request types, see the chapter "Advanced Printing Features" in Inside Macintosh: QuickDraw GX Printing.

The ImageWriter II printer driver overrides the GXJobFormatModeQuery message to implement its responses to the queries. Its implementation is the SD_JobFormatModeQuery function, a portion of which is shown in Listing 3-10.

Listing 3-10 Responding to a query about the job format mode

OSErr SD_JobFormatModeQuery( gxQueryType theQuery,
                        void* srcData, void* dstData)
{
   OSErr    anErr = noErr;
   Handle   theFonts;
   Handle   theStyles;
   
   switch(theQuery) 
   {
      case gxSetStyleJobFormatCommonStyleQuery:
      {
         char        *pStyleName;
         /* fetch the list of supported styles */
         anErr = Send_GXFetchTaggedDriverData('STR#',
                              kFormatModeStylesID, &theStyles);
         require(anErr == noErr, FailedToLoadStyles1);
         HNoPurge(theStyles);
         HLock(theStyles);

         /*
            Determine which style is being referenced and set

            the corresponding style (only two styles are
            currently supported).
         */
         
         if (**((short **) theStyles) == 2)
         {  /* the correct number of styles are in place */
            char  whichFace = 0;
            
            pStyleName = ((char *) *theStyles) + sizeof(short); 
            
            if ( IUCompString(pStyleName, (char *) srcData) == 0 )
            {  /* user wants bold face */
               whichFace = bold;
            }
            else
            {  /* point to next name in the list */
               pStyleName += *pStyleName + 1;
               if ( IUCompString(pStyleName,
                                 (char *) srcData) == 0 )
               {  /* user wants the underline face */
                  whichFace = underline;
               }
            }

               /* if user specified a valid face, set it now */
            if (whichFace != 0)
            {
               SetStyleCommonFace((gxStyle) dstData,
               GetStyleCommonFace((gxStyle) dstData) | whichFace);
            }
         }
         /* else - something is wrong with our resource */
         
         DisposHandle(theStyles);   /* dump temporary handle */
         
         break;
      }
The SD_JobFormatModeQuery function is designed as a switch statement, with code similar to that of Listing 3-10 (for the gxSetStyleJobFormatCommonStyleQuery request) included for each of the queries. The full version of this function is found in the QuickDraw GX sample code.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help